package com.deer.wms.rabbitmq;

public class ReceiveLog {
    private static final String EXCHANGE_NAME = "logs";

//    public static void main(String[] argv) throws Exception {
//        ConnectionFactory factory = null;
//        Connection connection = null;
//        Channel channel = null;
//        try{
//            factory = new ConnectionFactory();
//            connection = factory.newConnection();
//            channel = connection.createChannel();
//
//            factory.setHost("localhost");
//
//
//            channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
//            String queueName = channel.queueDeclare().getQueue();
//            channel.queueBind(queueName, EXCHANGE_NAME, "");
//
//            System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
//
//            DeliverCallback deliverCallback = (consumerTag, delivery) -> {
//                String message = new String(delivery.getBody(), "UTF-8");
//                System.out.println(" [x] Received '" + message + "'");
//            };
//            channel.basicConsume(queueName, true, deliverCallback, consumerTag -> { });
//        }catch (Exception e) {
//            throw new RuntimeException(e.getMessage());
//        }finally {
//            channel.close();
//            connection.close();
//        }

//    }
}
